package com.amit.jdbc.mysql;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class Lab2 {

	static Connection con=null;
	static Statement  st=null;
	public static void main(String[] args) {
		
		try
		{
		Connection con=JDBCUTIL.getmysqlconnection();
		System.out.println("amit");
		
		String sql="insert into amit values(6,'amityadav','amityadav@gmail.com',1233,23.0)";
		
		Statement st=con.createStatement();
		
		int i=st.executeUpdate(sql);
		
		System.out.println(i+"Record inserted");
		
		ResultSet rs=st.executeQuery("select * from amit");
		
		while(rs.next())
		{
			int sid=rs.getInt(1);
			String sname=rs.getString(2);
			String email=rs.getString(3);
			long phone=rs.getLong(4);
			float fee=rs.getFloat(5);
			
			System.out.println(sid+" "+sname+" "+email+" "+phone+" "+fee);
			
		}
			
		}
		
		catch (Exception e) {
			
			e.printStackTrace();
		
		}
		
		finally
		{
			JDBCUTIL.cleanup(st, con);
		}
		
	}

}
